package com.surenpi.jenkins.client.credential;

import com.fasterxml.jackson.annotation.JsonSubTypes;
import com.fasterxml.jackson.annotation.JsonTypeInfo;
import com.fasterxml.jackson.annotation.JsonSubTypes.Type;
import com.fasterxml.jackson.annotation.JsonTypeInfo.As;
import com.fasterxml.jackson.annotation.JsonTypeInfo.Id;
import com.surenpi.jenkins.client.BaseModel;
import java.util.Map;

@JsonTypeInfo(
   use = Id.NAME,
   include = As.PROPERTY,
   property = "typeName",
   defaultImpl = UserPasswdCredential.class
)
@JsonSubTypes({@Type(
   value = UserPasswdCredential.class,
   name = "Username with password"
), @Type(
   value = SSHKeyCredential.class,
   name = "SSH Username with private key"
), @Type(
   value = SecretTextCredential.class,
   name = "Secret text"
), @Type(
   value = CertificateCredential.class,
   name = "Certificate"
)})
public abstract class Credential extends BaseModel {
   protected static final String SCOPE_GLOBAL = "GLOBAL";
   private String id = "";
   private String scope = "GLOBAL";
   private String description = "";
   private String fullName = "";
   private String displayName = "";
   private String typeName = "";

   public String getScope() {
      return this.scope;
   }

   public void setScope(String scope) {
      this.scope = scope;
   }

   public String getDescription() {
      return this.description;
   }

   public void setDescription(String description) {
      this.description = description;
   }

   public String getId() {
      return this.id;
   }

   public void setId(String id) {
      this.id = id;
   }

   public String getFullName() {
      return this.fullName;
   }

   public void setFullName(String fullName) {
      this.fullName = fullName;
   }

   public String getTypeName() {
      return this.typeName;
   }

   public void setTypeName(String typeName) {
      this.typeName = typeName;
   }

   public String getDisplayName() {
      return this.displayName;
   }

   public void setDisplayName(String displayName) {
      this.displayName = displayName;
   }

   public abstract Map<String, Object> dataForCreate();

   public abstract Map<String, Object> dataForUpdate();
}
